#ifndef __CALIBRATION_H
#define __CALIBRATION_H

#include <stdint.h>

#define CALIBRATION_MAX_POINTS 10

typedef struct
{
    float x;
    float y;
} cubic_point_t;

typedef struct
{
    float a;
    float b;
    float c;
    float d;
    float max;
} cubic_param_t;

void CalibrationReset(void);
void CalibrationStartFit(void);
void CalibrationSetParam(cubic_param_t *new_param);
void CubicFit(cubic_param_t *param, const cubic_point_t *points, int n);
uint8_t CalibrationPointRecord(uint8_t index, float x, float y);
cubic_param_t *CalibrationGetParam(void);
float CalculateForwardPower(float x);
float CalculateSWR(float forward, float reverse);
float CalculateVoltageToWatt(float voltage);

#endif // __CALIBRATION_H
